package cn.lopr.im.android.service;

import android.app.Service;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.util.Log;

import cn.lopr.im.android.receiver.NotificationReceiver;

public class ForegroundService extends Service {
    private String TAG = "sfs";
    private NotificationReceiver notificationReceiver;

    public ForegroundService() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
        throw new UnsupportedOperationException("Not yet implemented");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "onCreate: " + "ForegroundService");
        notificationReceiver = new NotificationReceiver();
        IntentFilter filter = new IntentFilter("cn.lopr.im.android.servicecallback.content");
        //3.注册广播接收者
        registerReceiver(notificationReceiver, filter);

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unregisterReceiver(notificationReceiver);
    }
}